package com.example.myapplication6.bean;

import androidx.appcompat.app.AppCompatActivity;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class testGetListMeituan extends AppCompatActivity {
    public testGetListMeituan() {
    }

    public void testGetList() throws Exception {
        String path = "http://www.meituan.com/api/v2/beijing/deals";
        URL url = new URL(path);
        HttpURLConnection httpConn = (HttpURLConnection)url.openConnection();
        int responseCode = httpConn.getResponseCode();
        if (responseCode == 200) {
            InputStream input = httpConn.getInputStream();
            List<meituan> meituans = tuan_handler.getListMeituan(input, 0);
            Iterator var8 = meituans.iterator();

            while(var8.hasNext()) {
                meituan mei = (meituan)var8.next();
                System.out.println(mei);
            }
        }

    }

    public void testDatabase() throws Exception {
        tuangouData data = new tuangouData(this.getContext());
        data.getWritableDatabase();
    }

    public void testfind() throws Exception {
        DataIUDS data = new DataIUDS(this.getContext());
        meituan mei = data.find(2);
        System.out.println(mei);
    }

    public void testupdate() throws Exception {
        DataIUDS data = new DataIUDS(this.getContext());
        meituan mei = new meituan();
        mei.setCity_name("����");
        data.update(mei, 1);
        meituan mei1 = data.find(1);
        System.out.println(mei1);
    }

    public void testdelete() throws Exception {
        DataIUDS data = new DataIUDS(this.getContext());
        data.delete(1);
        meituan mei = data.find(1);
        System.out.println(mei);
    }

    public void testgetListMeituan() throws Exception {
        boolean noData = false;
        DataIUDS data = new DataIUDS(this.getContext());
        new ArrayList();
        List<meituan> meituans = data.getListData(0, 10);
        noData = meituans.isEmpty();
        Iterator var5 = meituans.iterator();

        while(var5.hasNext()) {
            meituan mei = (meituan)var5.next();
            System.out.println(mei);
        }

        System.out.println(noData);
    }

    public void testgetCount() throws Exception {
        DataIUDS data = new DataIUDS(this.getContext());
        int count = data.getCount();
        System.out.println(count);
    }
}
